﻿// CMouseObject.cs
// Author: Gant Briseno
#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
#endregion

namespace Casters.source.Objects
{
    public class CMouseObject : CRenderObject
    {

        public CMouseObject() : base()
        {
        }

        public override void LoadContent()
        {
            SetupRenderObject(0, CGame.GetInstance().Content.Load<Texture2D>("cursor"), new Vector2(CGame.GetInstance().viewPort.X * 0.5f, CGame.GetInstance().viewPort.Y * 0.5f), Vector2.Zero, Vector2.Zero, "none");
            CEventSystem.RegisterEventHandler(EventID.MouseMove, OnMouseMove);

            base.LoadContent();
        }

        public override void UnloadContent()
        {
            CEventSystem.UnregisterEventHandler(EventID.MouseMove, OnMouseMove);

            base.UnloadContent();
        }

        public override void Update(float dt)
        {
        }

        public override void Draw()
        {
            CRenderEngine.Draw(m_Texture, m_vPosition, Color.White);
        }

        public void OnMouseMove(params object[] eventArgs)
        {
            m_vPosition = (Vector2)eventArgs[0];
        }
    }
}
